package io.renren.modules.wcs.listenSlaveDB.controller;

import io.renren.modules.wcs.listenSlaveDB.entity.TestEntity2;
import io.renren.modules.wcs.listenSlaveDB.service.MysqlTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: 蔡翔
 * @Date: 2019/10/10 10:01
 * @Version 1.0
 */
@Component
public class MySqlBean {
    @Autowired
    MysqlTestService mysqlTestService;

    public boolean insert(TestEntity2 mysqlEntity){
        boolean flag = mysqlTestService.save(mysqlEntity);
        return flag;
    }

    public boolean saveAll(List<TestEntity2> testEntityList){
        return mysqlTestService.saveBatch(testEntityList);
    }

    public List<TestEntity2> selectAll(){
        return mysqlTestService.list();
    }
}

